home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 June / EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso / earcd / utilsys / rss14gmd.lha / RSys_1.4gmd / C / SpecialList.c < prev    next >
C/C++ Source or Header  |  1996-05-04  |  6KB  |  268 lines

  1. /*
  2.    ***************************************************************************
  3.    *
  4.    * Datei:
  5.    *      RSysSpecialList.c
  6.    *
  7.    * Inhalt:
  8.    *
  9.    *      --- Globale Routinen ---
  10.    *
  11.    *    void RSysAmigaGuideRefList ( void );
  12.    *    void SysAvailFontsList ( void );
  13.    *    void SysBrokerList ( void );
  14.    *
  15.    *      --- Lokale  Routinen ---
  16.    *
  17.    *
  18.    * Bemerkungen:
  19.    *      Spezielle Listen, die unter keine der anderen Kategorien fallen.
  20.    *
  21.    * Erstellungsdatum:
  22.    *      07-Jul-93     Rolf Böhme
  23.    *
  24.    * Änderungen:
  25.    *      07-Jul-93     Rolf Böhme        Erstellung
  26.    *
  27.    ***************************************************************************
  28.  */
  29.  
  30. #include "RSys.h"
  31. #include "protos.h"
  32.  
  33. void
  34. RSysAmigaGuideRefList (void)
  35. {
  36.   LIST listbuff, *list = &listbuff;
  37.   NODE *node;
  38.   XREF *xrefnode;
  39.   LONG key;
  40.   int i;
  41.   UBYTE *fpart, filename[16];
  42.   char *XRefTypes[] =
  43.   {
  44.     "LINK", "FUNC", "COMM", "INCL", "MACR",
  45.     "STRU", "FIEL", "TYPD", "DEFI"
  46.   };
  47.  
  48.   DPOS;
  49.  
  50.   HandleHelp (MN_RSysAmigaGuideRefList);
  51.  
  52.   PrintHeader (AGUIDEXREF, NULL);
  53.  
  54.   EmptyListView ();
  55.  
  56.   countentries = 0;
  57.  
  58.   if (AmigaGuideBase = (AMIGAGUIDEBASE *) OpenLibrary ((STRPTR) "amigaguide.library", 33))
  59.     {
  60.       key = LockAmigaGuideBase (NULL);
  61.  
  62.       if (GetAmigaGuideAttr (AGA_XRefList, NULL, (ULONG *) & list))
  63.     {
  64.       countentries = CountNodes (list);
  65.  
  66.       if (!NoEntries ())
  67.         {
  68.           Entries = AllocScrollEntries (countentries);
  69.  
  70.           for (node = list->lh_Head, i = 0; node->ln_Succ && (i < countentries); node = node->ln_Succ, i++)
  71.         {
  72.           xrefnode = (XREF *) node;
  73.  
  74.           fpart = FilePart (xrefnode->xr_File);
  75.  
  76.           if (fpart != xrefnode->xr_File)
  77.             sprintf ((char *) filename, "+%-14s.14s", fpart);
  78.           else
  79.             strncpy ((char *) filename, (char *) xrefnode->xr_File, 15);
  80.  
  81.           Entries[i].se_obj_id.address = xrefnode;
  82.  
  83.           sprintf (Entries[i].se_Entry, EntryAttr[AGUIDEXREF].ea_dataformat,
  84.                xrefnode,
  85.                xrefnode->xr_Name, XRefTypes[node->ln_Type],
  86.                filename, xrefnode->xr_Line);
  87.         }
  88.  
  89.           CreateEntryList (SORT, 9);
  90.         }
  91.     }
  92.  
  93.       UnlockAmigaGuideBase (key);
  94.  
  95.       CloseLibrary ((LIBRARY *) AmigaGuideBase);
  96.     }
  97.   else
  98.     ErrorHandle ("amigaguide.library", LIBRARY_ERR, OPEN_FAIL, KILL);
  99.  
  100.   PrintStatistics ();
  101.  
  102.   return;
  103. }
  104.  
  105. void
  106. SysBrokerList (void)
  107. {
  108.   NODE *node, *nodes[MAX_BROKER_ENTRIES], *StartNode, *foundBroker = NULL;
  109.   APTR adr[MAX_BROKER_ENTRIES];
  110.   char name[MAX_BROKER_ENTRIES][22];
  111.   int pri[MAX_BROKER_ENTRIES], i, cnt;
  112.  
  113.   DPOS;
  114.  
  115.   HandleHelp (MN_SysBrokerList);
  116.  
  117.   PrintHeader (COMMODITIES, NULL);
  118.  
  119.   EmptyListView ();
  120.  
  121.   /*
  122.    * Analog zu FindName() oder FindPort() kann auch hier ein
  123.    * Schutzprotokoll nötig sein. Da Commodities auch mit Interrupts
  124.    * arbeiten müssen (InputHandler!), sollte gleich mit
  125.    * Disable()/Enable() hingelangt werden!
  126.    */
  127.   Disable ();
  128.  
  129.   foundBroker = (NODE *) broker;
  130.  
  131.   for (node = foundBroker; node->ln_Pred; node = node->ln_Pred)
  132.     StartNode = node;
  133.  
  134.   for (node = StartNode, cnt = 0;
  135.        node->ln_Succ && (cnt < MAX_BROKER_ENTRIES);
  136.        node = node->ln_Succ)
  137.     {
  138.       /*
  139.        * Vitale Daten kopieren; der Type ist unbekannt! Damit
  140.        * dennoch die Namen ausgegeben werden können, übergebe ich
  141.        * einfach den Node-Typen.
  142.        */
  143.       savestrcpy (name[cnt], node, 22, (int) node->ln_Type);
  144.       adr[cnt] = node;
  145.       pri[cnt] = node->ln_Pri;
  146.       nodes[cnt++] = node;
  147.     }
  148.  
  149.   Enable ();
  150.  
  151.   countentries = cnt;
  152.  
  153.   if (NoEntries ())
  154.     return;
  155.  
  156.   Entries = AllocScrollEntries (countentries);
  157.  
  158.   for (i = 0; i < cnt; i++)
  159.     {
  160.       Entries[i].se_obj_id.address = adr[i];
  161.  
  162.       sprintf (Entries[i].se_Entry,
  163.            EntryAttr[COMMODITIES].ea_dataformat,
  164.            adr[i], name[i], pri[i]);
  165.  
  166.       AddNodeToList (i, SORT, 9);
  167.     }
  168.  
  169.   PrintStatistics ();
  170.  
  171.   return;
  172. }
  173.  
  174.  /*
  175.   * SysAvailFontsList() listet alle Fonts im Verzeichnis
  176.   * FONTS: auf
  177.   */
  178. void
  179. SysAvailFontsList (void)
  180. {
  181.   char Style[MAXSHOW];
  182.   char *Type[5] =
  183.   {
  184.     "-", "ROM", "DISK", "-", "SCAL"
  185.   };
  186.   AVAILFONTSHEADER *afh;
  187.   AVAILFONTS *AF;
  188.   int extrabytes, initialsize = sizeof (AVAILFONTSHEADER), i;
  189.  
  190.   DPOS;
  191.  
  192.   HandleHelp (MN_SysAvailFontsList);
  193.  
  194.   PrintHeader (ALLFONTS, NULL);
  195.  
  196.   EmptyListView ();
  197.  
  198.   PrintInfo ("Read all Fonts", NO_SPEAK, 0);
  199.  
  200.   do
  201.     {
  202.       afh = (AVAILFONTSHEADER *) MyAllocVec (initialsize, MEMF_CLEAR | MEMF_ANY, KILL);
  203.  
  204.       if (afh)
  205.     {
  206.       extrabytes = AvailFonts ((STRPTR) afh, initialsize, AFF_DISK);
  207.       if (extrabytes)
  208.         {
  209.           MyFreeVec (afh);
  210.           initialsize += extrabytes;
  211.         }
  212.     }
  213.     }
  214.   while (extrabytes);
  215.  
  216.   countentries = afh->afh_NumEntries;
  217.  
  218.   if (NoEntries ())
  219.     return;
  220.  
  221.   Entries = AllocScrollEntries (countentries);
  222.  
  223.   AF = (AVAILFONTS *) & (afh[1]);
  224.  
  225.   for (i = 0; i < countentries; i++)
  226.     {
  227.       strcpy (Style, "       ");
  228.  
  229.       if (!(AF[i].af_Attr.ta_Style & FS_NORMAL))
  230.     Style[0] = 'N';
  231.  
  232.       if (AF[i].af_Attr.ta_Style & FSF_UNDERLINED)
  233.     Style[1] = 'U';
  234.  
  235.       if (AF[i].af_Attr.ta_Style & FSF_BOLD)
  236.     Style[2] = 'B';
  237.  
  238.       if (AF[i].af_Attr.ta_Style & FSF_ITALIC)
  239.     Style[3] = 'I';
  240.  
  241.       if (AF[i].af_Attr.ta_Style & FSF_EXTENDED)
  242.     Style[4] = 'E';
  243.  
  244.       if (AF[i].af_Attr.ta_Style & FSF_COLORFONT)
  245.     Style[5] = 'C';
  246.  
  247.       if (AF[i].af_Attr.ta_Style & FSF_TAGGED)
  248.     Style[6] = 'T';
  249.  
  250.       Style[7] = STRINGEND;
  251.  
  252.       Entries[i].se_obj_id.address = &AF[i];
  253.       sprintf (Entries[i].se_Entry, EntryAttr[ALLFONTS].ea_dataformat,
  254.            AF[i].af_Attr.ta_Name,
  255.            Type[AF[i].af_Type],
  256.            AF[i].af_Attr.ta_YSize,
  257.            Style);
  258.  
  259.       AddNodeToList (i, SORT, 0);
  260.     }
  261.  
  262.   MyFreeVec (afh);
  263.  
  264.   PrintStatistics ();
  265.  
  266.   return;
  267. }
  268.